package com.hznu.jspFinal.service;


import com.hznu.jspFinal.dao.AttendExamMapper;
import com.hznu.jspFinal.entity.AttendExam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AttendExamServiceImpl implements AttendExamService{

    @Autowired
    AttendExamMapper attendExamMapper;

    @Override
    public void addBatch(Integer examId, Integer[] studentIdList)
    {
        for(Integer studentId :studentIdList)
        {
            AttendExam attendExam = new AttendExam();
            attendExam.setExamid(examId);
            attendExam.setStudentid(studentId);
            attendExamMapper.insertSelective(attendExam);
        }
    }

    @Override
    public List<AttendExam> findByCondition(AttendExam attendExam)
    {
        return attendExamMapper.selectByCondition(attendExam);
    }
}
